docs links test improvements - #20797
Conversation
Reviewer's GuideParametrizes the documentation links E2E test per page and introduces a shared module-scoped UI session to speed up execution while preserving per-page link collection and validation logic. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
| else: | ||
| view = page_object.navigate_to(page_object, 'All') | ||
| # Get the doc links present on the page. | ||
| all_links[page] = view.documentation_links() |
There was a problem hiding this comment.
Now that the test is parametrized, all_links and pages_with_broken_links can be one-dimensional arrays instead of dicts.
| all_links[page] = view.documentation_links() | |
| all_links = view.documentation_links() |
There was a problem hiding this comment.
You're right. I replaced pages_with_broken_links dict with broken_links list
|
trigger: test-robottelo |
|
PRT Result |
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider renaming the module-scoped fixture from
sessionto something more specific likeui_sessionto avoid confusion with other commonsessionconcepts (e.g.,requests.Session, pytest session scope) and improve readability. - The logic for fetching and normalizing documentation links makes two
requests.getcalls in the non-GA case (first for redirect resolution and then for status); consider reusing the first response or extracting a small helper to avoid duplicate network calls and clarify the flow.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider renaming the module-scoped fixture from `session` to something more specific like `ui_session` to avoid confusion with other common `session` concepts (e.g., `requests.Session`, pytest session scope) and improve readability.
- The logic for fetching and normalizing documentation links makes two `requests.get` calls in the non-GA case (first for redirect resolution and then for status); consider reusing the first response or extracting a small helper to avoid duplicate network calls and clarify the flow.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
It appears the version for which the stage docs do not exist (6.20) is also tested, or at least in PRT. Should a solution be devised to avoid this scenario? |
|
I did a workaround - I created a cherry-pick of this PR into 6.19.z branch. The PRT passed there, because 6.19 docs are already present in staging. |
|
It still is probably a good idea to have this on master too so it gets branched automatically in future versions. Should we merge this as is or can we prevent this test to trigger on the stream snaps? |
adamlazik1
left a comment
There was a problem hiding this comment.
LGTM after offline discussion.
| # Get the end url first and then update it in later part of test. | ||
| if module_target_sat.hostname in link: | ||
| link = requests.get(link, verify=False).url | ||
| link = link.replace('https://docs.redhat.com', settings.robottelo.stage_docs_url) |
There was a problem hiding this comment.
I feel instead of hardcoding this prod docs url here, we can move it to settings as well?
There was a problem hiding this comment.
I have the same concern, but there's already some work going on within SAT-41490. The documentation portal can be customizable. I expect to modify this hardcoded part when creating new test(s) for this new feature.
|
|
PRT Result |
|
|
PRT Result |
Improvements to test_positive_documentation_links:
Summary by Sourcery
Parametrize documentation link E2E test by page and reuse a shared UI session to speed up execution while keeping per-page assertions and logging.
Tests:
test_positive_documentation_linksover individual pages instead of looping internally, producing separate test cases per page.Summary by Sourcery
Parametrize the documentation links E2E test per page and reuse a shared UI session to speed up execution and improve failure isolation.
Tests:
test_positive_documentation_linksinto parametrized per-page test cases for clearer reporting of broken links.